package com.iqiyi.pps.epg.web.timer;

import com.iqiyi.pps.epg.core.service.program.ProgramService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * Created by Lemuel on 2016/5/24.
 */
public class PlayStatusUpdateTrigger {
    private static Logger logger = LoggerFactory.getLogger(PlayStatusUpdateTrigger.class);

    @Autowired
    private ProgramService programService;

    public void task() {
        long startTime = System.currentTimeMillis();
        logger.info("[PlayStatusUpdateTrigger] task start");
        updatePlayStatus();
        long endTime = System.currentTimeMillis();
        logger.info("[PlayStatusUpdateTrigger] task end : " + (endTime - startTime));
    }

    private void updatePlayStatus() {
      int executeUpdate =  programService.updatePlayStatus();
        logger.info("[updatePlaystatus][executeUpdate={}]",executeUpdate);
    }
}
